package com.wcity.manage.service.impl;

import com.wcity.manage.dao.dal.model.PageModel;
import com.wcity.manage.dao.mapper.PropertyFeeMapper;
import com.wcity.manage.dao.model.Payment;
import com.wcity.manage.dao.model.Property;
import com.wcity.manage.service.property.PropertyFeeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 小区物业费组成管理模块
 * Created by zm on 2016/12/12.
 */
@Service
public class PropertyFeeServiceImpl implements PropertyFeeService {

    @Resource private PropertyFeeMapper propertyFeeMapper;

    /**
     * 分页查询
     * @param page
     * @return
     */
    @Override
    public List<Property> getPayTypeListPage(PageModel<Property> page) {
        return propertyFeeMapper.findListPage(page);
    }

    /**
     * 根据userid获取小区名字
     * @param id
     * @return
     */
    @Override
    public List<Property> getblockName(int id) {
        return propertyFeeMapper.getblockName(id);
    }

    /**
     * 根据userid获取缴费类型
     * @param id
     * @return
     */
    @Override
    public List<Payment> getPayType(int id) {
        return propertyFeeMapper.getPayType(id);
    }

    /**
     * 添加
     * @param propertyFee
     * @return
     */
    @Override
    public int feeAdd(Property propertyFee) {
        return propertyFeeMapper.insert(propertyFee);
    }

    /**
     * 根据id获取信息
     * @param id
     * @return
     */
    @Override
    public Property getInfo(String id) {
        return propertyFeeMapper.getInfo(id);
    }

    /**
     * 修改
     * @param propertyFee
     * @return
     */
    @Override
    public int updatePropertyFee(Property propertyFee) {
        return propertyFeeMapper.update(propertyFee);
    }

    /**
     * 删除
     * @param id
     * @return
     */
    @Override
    public int feeDelect(String id) {
        return propertyFeeMapper.delete(id);
    }

    /**
     * 查询添加是否重复
     * @param block_name
     */
    @Override
    public int selectBlockNameCount(String block_name) {
        return propertyFeeMapper.getCount(block_name);
    }

    /**
     * 根据小区名称查询缴费类型
     * @param id
     * @param block_name
     * @return
     */
    @Override
    public Property getPayType1(int id, String block_name) {
        return propertyFeeMapper.getPayType1(id,block_name);
    }

    /**
     * 根据小区id查询缴费类型
     * @param id
     * @param blockId
     * @return
     */
    @Override
    public Property getPayType2(int id, int blockId) {
        return propertyFeeMapper.getPayType2(id,blockId);
    }
}
